package com.lechuang.order.excel;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author liaoningbo
 * @since 2023-06-20
 */
@Data
//@Accessors(chain = true) //不能加，加上会导致解析到的数据，属性全是null
@ColumnWidth(25)
public class ExcelDTO implements Serializable {
    @ExcelProperty(value = "商品名称", index = 0)
    private String name;

    @ExcelProperty(value = "单价", index = 1)
    @NumberFormat("#,##0.000")
    private BigDecimal price;

    @DateTimeFormat(DatePattern.NORM_DATETIME_PATTERN)
    @ExcelProperty(value = {"时间", "创建时间"}, index = 2)
    private Date createTime;

    @DateTimeFormat(DatePattern.NORM_DATETIME_PATTERN)
    @ExcelProperty(value = {"时间", "修改时间"}, index = 3)
    private Date updateTime;
}
